const auth = async (ctx, next) => {
    if (ctx.session.user) {
        // 重新设置session，确保session不超时
        await next();
    } else {
        ctx.body = { code: 401, msg: "请先登录" };
    }
};

module.exports = auth;
